import {Injectable} from '@angular/core';
import {BaseHttpService} from './base-http.service';
import {FileTypeObj, PageInfo, SearchCommonVO} from '../types';
import {Observable} from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class ChatService {

  constructor(public http: BaseHttpService) {
  }

  public addLabelType(param: FileTypeObj): Observable<PageInfo<FileTypeObj>> {
    return this.http.post('/add-type', param, {needSuccessInfo: false});
  }

  public getLabelTypeList(param: SearchCommonVO<any>): Observable<PageInfo<FileTypeObj>> {
    return this.http.post('/type', param, {needSuccessInfo: false});
  }

  public getLabelTypeDetail(id: number): Observable<FileTypeObj> {
    return this.http.get(`/type/${id}`);
  }

  public delLabelType(ids: number[]): Observable<void> {
    return this.http.post('/del-type', {ids}, {needSuccessInfo: true});
  }

  public editLabelType(param: FileTypeObj): Observable<any> {
    return this.http.post('/update-type', param, {needSuccessInfo: true});
  }

}
